home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Description:
- // This script is executed when a file is opened. It will create panels
- // only if no panels exist.
- //
- // Creation Date:
- // Author:
- //
-
- global proc buildDefaultSceneUI() {
- global string $gMainPane;
-
- if (`paneLayout -exists $gMainPane`) {
- string $panels[] = `getPanel -all`;
- if (size($panels) == 0) {
- //
- // Currently no panels so use the new file panels configuration.
- //
- buildNewSceneUI;
- } else {
- //
- // Check that filters exist
- //
- string $filters[] = `ls -type objectFilter`;
- if (size($filters) == 0) {
- initDefaultFilters;
- }
-
- //
- // Init any panels that need it.
- //
- string $panels[] = `getPanel -all`;
- string $panel;
-
- for ($panel in $panels) {
- if (`panel -q -ni $panel`) {
- panel -e -init $panel;
- }
- }
-
- //
- // get current state of the UI
- //
- sceneUIReplacement -update $gMainPane;
-
- int $menusOkayInPanels = `optionVar -q allowMenusInPanels`;
- //
- // Initialize the Relationship Editor.
- //
- if (`exists relationshipEditor`) {
- $panelLabel = "Relationship Editor";
- $panelName =
- `sceneUIReplacement
- -getNextScriptedPanel"relationshipPanel"
- $panelLabel`;
- if ("" == $panelName) {
- $panelName = `scriptedPanel -mbv $menusOkayInPanels
- -unParent -type "relationshipPanel"
- -l $panelLabel`;
- } else {
- scriptedPanel -edit -l $panelLabel $panelName;
- }
- }
-
- string $match, $relationshipEditorPanel = "";
-
- // Find the Relationship Editor panel.
- //
- string $allPanels[] = `getPanel -allPanels`;
- for ($panel in $allPanels) {
- $match = match("relationshipPanel", $panel);
- if ("" != $match) {
- $relationshipEditorPanel = $panel;
- break;
- }
- }
-
- // Check if Set Editor or Shading Group Editor is one of the visible
- // panels. If they are then replace them with the Relationship Editor.
- //
- $allPanels = `getPanel -allPanels`;
- for ($panel in $allPanels) {
- $match = match("setEditor", $panel);
- if ("" != $match) {
- warning ("The scene has a Set "
- + "Editor in it. This editor is replaced by the "
- + "Relationship Editor in Maya 2.0.");
- if ("" != $relationshipEditorPanel) {
- scriptedPanel -edit -replacePanel $panel $relationshipEditorPanel;
- }
- deleteUI -panel $panel;
- }
- $match = match("shadingGroupEditor", $panel);
- if ("" != $match) {
- warning ("The scene has a Shading "
- + "Group Editor in it. This editor is replaced by "
- + "the Relationship Editor in Maya 2.0.");
- if ("" != $relationshipEditorPanel) {
- scriptedPanel -edit -replacePanel $panel $relationshipEditorPanel;
- }
- deleteUI -panel $panel;
- }
- }
- updatePanelLayoutFromCurrent( "Current Layout" );
-
- //
- // Make sure Hypershade and Visor panels are present.
- //
- int $menusOkayInPanels = `optionVar -q allowMenusInPanels`;
- string $panelName, $editorName;
-
- string $panels[] = `getPanel -scriptType "hyperShadePanel"`;
- if (`size($panels)` == 0) {
- $panelName =
- `scriptedPanel
- -menuBarVisible $menusOkayInPanels
- -unParent
- -type "hyperShadePanel"
- -label "Hypershade"`;
- }
-
- $panels = `getPanel -scriptType "visorPanel"`;
- if (`size($panels)` == 0) {
- $panelName =
- `scriptedPanel
- -menuBarVisible $menusOkayInPanels
- -unParent
- -type "visorPanel"
- -label "Visor"`;
- $editorName = ($panelName+"VisorEd");
- hyperGraph -e
- -graphType "Visor"
- -dn defaultShaderList
- $editorName;
- }
-
- // Make sure the clip editor exists.
- $panels = `getPanel -scriptType "clipEditorPanel"`;
- if (`size($panels)` == 0) {
- $panelName = `scriptedPanel -mbv $menusOkayInPanels
- -unParent -type "clipEditorPanel" -l "Trax Editor"`;
- $editorName = ($panelName+"ClipEditor");
- }
-
- // Make sure the Reference Editor panel exists.
- //
- string $panels[] = `getPanel -scriptType "referenceEditorPanel"`;
- if (`size($panels)` == 0) {
- $panelName = `scriptedPanel -mbv $menusOkayInPanels
- -unParent -type "referenceEditorPanel"
- -l "Reference Editor"`;
- }
-
- // Turn off isolate select in all model panels
- string $panels[] = `getPanel -type modelPanel`;
- for ($panel in $panels) {
- modelEditor -edit -viewSelected false $panel;
- editor -edit -lck -mainListConnection "activeList" $panel;
- }
- }
- }
-
- // reset playblast optionVars
- //
- string $filename = `file -q -sn`;
- if ($filename != "") {
- string $tokens[];
- tokenize($filename,"/",$tokens);
- $filename = $tokens[size($tokens)-1];
- clear $tokens;
- tokenize($filename,".",$tokens);
- $filename = $tokens[0];
- } else {
- // no filename, use "playblast" as the default
- // playblast file name
- $filename = "playblast";
- }
- optionVar -stringValue playblastFile $filename;
-
- if (`isTrue MayaCreatorExists`) {
- //
- // Make sure that we have a Creator panel.
- //
- string $result[] = `getPanel -scriptType "dynPaintScriptedPanelType"`;
- if ( size( $result ) == 0 ) {
- //
- // Need to create a new one.
- //
- string $panelName = `scriptedPanel -unParent -type "dynPaintScriptedPanelType" -l "Paint Effects" dynPaintScriptedPanel`;
- dynPaintPanel $panelName;
- }
- }
- }
-